package com.kehutong.charge.util.enums;

import org.coraframework.util.HashID;

import java.util.EnumSet;
import java.util.HashMap;

/**
 * @program: kht
 * @description: 缴费状态枚举
 * @author: joneron
 * @create: 2021/7/5
 **/
public enum ChargeStatusEnum implements HashID {

    CS_UN_TREATED("1","待处理"),
    CS_TREATED("2","已处理"),
    CS_REFUND("3","退款中"),
    CS_REFUSE("4","已拒绝"),
    CS_SUCCESS("5","退款成功"),
    CS_FALL("6","退款失败"),
    ;

    private final String id;
    private final String desc;

    private ChargeStatusEnum(String id, String desc) {
        this.id = id;
        this.desc = desc;
    }


    public static String getEnumState(String id){
        for (ChargeStatusEnum typeEnum : values()) {
            if (typeEnum.id.equals(id)) {
                return typeEnum.desc;
            }
        }
        return "";
    }


    /**
     * 获取map集合
     * @return
     */
    public static HashMap<String,String> getMap() {
        HashMap<String, String> map = new HashMap<>();
        for (ChargeStatusEnum enums : EnumSet.allOf(ChargeStatusEnum.class)) {
            map.put(enums.id, enums.desc);
        }
        return map;
    }

    @Override
    public String getId() {
        return id;
    }


    @Override
    public String getDesc() {
        return desc;
    }
}
